<template>
  <div>
    <tableComponents
      :pagination="{ currentPage, pageSize, total: list.all_num }"
      @handleCurrentChange="handleCurrentChange"
      @handleSizeChange="handleSizeChange"
      @sendUserSearch="getSearch"
      :searchData="searchData"
      :isHaveAdd="false"
      exportUrl="/api/admin/export/payment_lists"
    >
      <template v-slot:table>
        <el-table
          ref="multipleTable"
          :data="list.data"
          stripe
          v-loading="loading"
          header-row-class-name="head_color"
          tooltip-effect="dark"
          style="width: 99.8%"
        >
          <el-table-column label="用户头像" min-width="80">
            <template slot-scope="scope">
              <img
                v-if="scope.row.avatar"
                :src="$fnc.getImgUrl(scope.row.avatar)"
                width="80px"
                height="80px"
                style="border-radius: 50%;"
              />
            </template>
          </el-table-column>

          <el-table-column label="支付用户" min-width="120">
            <template slot-scope="scope">
              <p>账号：{{ scope.row.username }}</p>
              <p>名称：{{ scope.row.nickname }}</p>
            </template>
          </el-table-column>

          <el-table-column label="订单号" min-width="150">
            <template slot-scope="scope">
              <p>平台订单号：{{ scope.row.oid }}</p>
              <p>商家订单号：{{ scope.row.trade_no }}</p>
            </template>
          </el-table-column>

          <el-table-column label="支付信息" min-width="120">
            <template slot-scope="scope">
              <p>金额：{{ scope.row.money | keepTwoNum }}</p>
              <p>类型：{{ scope.row.cate }}</p>
              <p>方式：{{ scope.row.types }}</p>
              <p>备注：{{ scope.row.remark }}</p>
            </template>
          </el-table-column>

          <el-table-column label="支付时间" min-width="120">
            <template slot-scope="scope">{{ scope.row.created_time | getTimeFormat}}</template>
          </el-table-column>
        </el-table>
      </template>
      <template v-slot:footerLeft>汇总金额：{{list.sum || 0}}元</template>
    </tableComponents>
  </div>
</template>
<script>
import { paymentSearchData } from "@/assets/js/searchData/searchData"; //引入搜索的数据
export default {
  data() {
    return {
      searchData: paymentSearchData,
      loading: false,
      list: [],
      pageSize: 10,
      currentPage: 1,
      searchAll: {},
    };
  },
  components: {},
  methods: {
    getSearch(obj) {
      this.searchAll = obj;
      this.getNewsAll(obj);
    },
    getNewsAll(data) {
      this.loading = true;
      var params = {};
      data = data || {};
      params = data;

      this.$api.getUser.payment_lists(params).then((res) => {
        if (res.data.code == 200) {
          this.list = res.data.result;
        }
        this.loading = false;
      });
    },
    handleSizeChange: function (size) {
      var params = this.searchAll;
      params.page = 1;
      params.page_size = size;
      this.pageSize = size;
      this.currentPage = 1;
      this.getNewsAll(params);
    },
    handleCurrentChange: function (currentPage) {
      var params = this.searchAll;
      params.page = currentPage;
      params.page_size = this.pageSize;
      this.currentPage = parseInt(currentPage);
      this.getNewsAll(params);
    },
  },
  created() {
    this.getNewsAll();
  },
};
</script>

<style lang="less" scoped>
</style>
